package com.ktdaddy.enums;

/**
 * @author kdaddy@163.com
 * @date 2021/7/15 23:11
 */
public enum WhaleErrorCode implements ErrorCode {
    GLOBAL_SYSTEM_ERROR(1001, 1, 99999, "系统错误"),
    DB_INSERT_ERROR(1001, 1, 10001, "数据创建失败"),
    DB_UPDATE_ERROR(1001, 1, 10002, "数据更新失败"),
    DB_ALREADY_EXISTED(1001, 1, 10003, "数据已存在"),
    DB_DELETE_ERROR(1001, 1, 10004, "数据删除失败"),

    ROLE_CODE_EXIST(1001,2,10001,"该编号角色已经存在"),
    ROLE_NAME_EXIST(1001,2,10002,"该名称角色已经存在"),
    ROLE_NOT_EXIST(1001,2,10003,"当前角色不存在"),

    DEPT_NAME_EXIST(1001,2,1004,"该名称的部门已经存在"),
    ROOT_NODE_NOT_SUPPORT_REMOVE(1001,2,1005,"根节点不支持移动调整"),
    ROOT_NODE_DELETE_ERROR(1001,2,1006,"存在子节点，无法直接删除，优先删除子节点"),

    USER_NOT_EXIST(1001,2,1007,"用户信息不存在"),
    KERNEL_NAME_EXIST(1001,2,1008,"用户名已存在"),
    KERNEL_NOT_EXIST(1001,2,1009,"关键用户信息不存在"),
    KERNEL_MOBILE_EXIST(1001,2,1010,"手机号已被占用"),
    KERNEL_EMAIL_EXIST(1001,2,1011,"邮箱已被占用"),
    CURRENT_PASSWORD_ERROR(1001,2,1012,"当前密码输入错误"),

    MENU_EXIST_ERROR(1001,2,1013,"当前菜单已存在")
    ;

    private final int errorCode;
    private final String errorMsg;


    WhaleErrorCode(int firstCode, int secondCode, int thirdCode, String errorMsg) {
        int code = 1000000 * firstCode + 100000 * secondCode + thirdCode;
        this.errorCode = code;
        this.errorMsg = errorMsg;
    }

    @Override
    public int getErrorCode() {
        return errorCode;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }
}
